// 封装获取频道列表的函数
import { getChannelsService } from '@/apis/article.js'
import { useEffect, useState } from 'react'
const useChannel = () => {
  const [channels, setChannels] = useState([])
  const getChannels = async () => {
    const res = await getChannelsService()
    setChannels(res.data.channels)
  }

  useEffect(() => {
    getChannels()
  }, [])
  // return要用到的状态数据
  return {
    channels
  }
}

export default useChannel
